package vip.liux.contracts.repositories.pay;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.ListCrudRepository;
import org.springframework.data.repository.ListPagingAndSortingRepository;
import org.springframework.data.repository.NoRepositoryBean;
import vip.liux.contracts.models.pay.PayWallet;

import java.math.BigDecimal;
import java.util.Optional;

@NoRepositoryBean
public interface PayWalletRepository extends ListPagingAndSortingRepository<PayWallet, Long>, ListCrudRepository<PayWallet, Long> {
    Optional<PayWallet> findByUid(String userId);

    Page<PayWallet> findPage(String uid, Pageable page);

    int freezePrice(Long id, BigDecimal price);

    int unFreezePrice(Long id, BigDecimal price);

    int updateWhenConsumption(Long id, BigDecimal price);

    int updateWhenRechargeRefund(Long id, BigDecimal price);

    void updateWhenConsumptionRefund(Long id, BigDecimal price);

    void updateWhenRecharge(Long id, BigDecimal price);

    void updateWhenAdd(Long id, BigDecimal price);
}